import 'package:app/common/tool.dart';
import 'package:app/components/base_scaffold_appbar.dart';
import 'package:app/components/nodata_page.dart';
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';

import '../../../utils/search_module.dart';
import '../../milepost_module/milepost_view.dart';
import '../published_project_module/published_project_view.dart';
import 'my_project_detail_controller.dart';

class ProjectManagerView extends GetView{


  MyProjectDetailController controller = Get.put(MyProjectDetailController());

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: BaseAppBar(
        preferredSize: Size(Get.width, AppTool.appBarHEIGHT),
        child: Text('项目管理'),
      ),
      body: GetBuilder<MyProjectDetailController>(builder: (_){
        return Container(
          child: Column(
            children: [
              Container(
                height: 45,
                child: BrnTabBar(
                  labelStyle: TextStyle(fontSize: 14),
                  unselectedLabelStyle: TextStyle(fontSize: 14),
                  controller: controller.tabController,
                  tabs: controller.tabs,
                ),
              ),
              Expanded(child: TabBarView(
                controller: controller.tabController,
                children: [
                  // ProjectDetailPage(),
                  PubLishedProjectView(),
                  NoDataPage(),
                  MilepostView()
                ],
              ))
            ],
          ),
        );
      }),
    );
  }
}


class ProjectDetailPage extends StatefulWidget {
  const ProjectDetailPage({Key? key}) : super(key: key);

  @override
  State<ProjectDetailPage> createState() => _ProjectDetailPageState();
}

class _ProjectDetailPageState extends State<ProjectDetailPage> {


  TextEditingController projectNameController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        SearchModule.closeKeyboard(context);
      },
      onPanDown: (_) {
        /// 列表滑动响应
        SearchModule.closeKeyboard(context);
      },
      child: Container(
        child: EasyRefresh.custom(
          slivers: [
            SliverToBoxAdapter(
              child: Container(
                color: Colors.white,
                height: 110,
                padding: EdgeInsets.only(left: 10,top: 15),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text('项目名称'),
                    TextField(
                      decoration: InputDecoration(
                          border: InputBorder.none
                      ),
                      maxLines: 3,
                      controller: projectNameController..text = '111',
                    ),

                  ],
                ),
              ),
            ),
            SliverToBoxAdapter(
              child: SizedBox(
                height: 1,
              ),
            ),
            SliverToBoxAdapter(
              child: Container(
                color: Colors.white,
                height: 110,
                padding: EdgeInsets.only(left: 10,top: 15),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text('项目描述'),
                    TextField(
                      decoration: InputDecoration(
                          border: InputBorder.none
                      ),
                      maxLines: 3,
                      controller: projectNameController..text = '111',
                    ),

                  ],
                ),
              ),
            ),
            SliverToBoxAdapter(
              child: SizedBox(
                height: 1,
              ),
            ),

            SliverToBoxAdapter(
              child: Container(
                padding: EdgeInsets.only(left: 10,right: 15),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('管理人员'),
                    Text('管理人员'),
                  ],
                ),
                color: Colors.white,
                height: 45,
              ),
            ),
            SliverToBoxAdapter(
              child: Container(
                padding: EdgeInsets.only(left: 10,right: 15),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('开始日期'),
                    Text('开始日期'),
                  ],
                ),
                color: Colors.white,
                height: 45,
              ),
            ),
            SliverToBoxAdapter(
              child: Container(
                padding: EdgeInsets.only(left: 10,right: 15),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('结束日期'),
                    Text('结束日期'),
                  ],
                ),
                color: Colors.white,
                height: 45,
              ),
            ),
            SliverToBoxAdapter(
              child: Container(
                padding: EdgeInsets.only(left: 10,right: 15),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('任务状态'),
                    Text('任务状态'),
                  ],
                ),
                color: Colors.white,
                height: 45,
              ),
            ),
            SliverToBoxAdapter(
              child: Container(
                padding: EdgeInsets.only(left: 10,right: 15),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('任务数量'),
                    Text('任务数量'),
                  ],
                ),
                color: Colors.white,
                height: 45,
              ),
            ),
            SliverToBoxAdapter(
              child: Container(
                padding: EdgeInsets.only(left: 10,right: 15),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('项目进度'),
                    Text('项目进度'),
                  ],
                ),
                color: Colors.white,
                height: 45,
              ),
            ),

          ],
        ),
      ),
    );
  }
}

